home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-05 | 501 b | 25 lines | [MATF/MATL] |
- function p = tch(C,n,x,a,b)
- % p = tch(C,n,x)
- % p = tch(C,n,x,a,b)
- % C is the coefficient list, input.
- % n is the degree, input.
- % x are the value(s), input.
- % a is the left endpoint, input.
- % b is the right endpoint, input.
- % p are the function value(s), output.
- if nargin==3, a=-1; b=1; end
- x = 2*(x-a)/(b-a) - 1;
- T0 = ones(1,length(x));
- p = C(1)*T0;
- if n==0, return, end
- T1 = x;
- p = p + C(2)*T1;
- if n==1, return, end
- for j=3:n+1,
- Tj = 2*x.*T1 - T0;
- p = p + C(j)*Tj;
- T0 = T1;
- T1 = Tj;
- end
-
-